<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="/home/css/_reset.css" />
		<link rel="stylesheet" type="text/css" href="/home/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="/home/css/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="/home/css/recommend.css" />
	</head>
	
	<body style="overflow-x: hidden;">
		<div class="recommend row">
			<div class="container-fluid">
				<div class="mk">
					<a href="javascript:history.back(-1)" class="back"><</a>
				<div class="input">
					<input type="hidden" name="u_tel" value="{$u_tel}" id="u_tel" />
					<ul>
						<li><span>推荐ID</span><input type="text" placeholder="" name="recom_id" id="recom_id" value="" /></li>
						<li><span>姓名</span><input type="text" placeholder="" name="u_name" id="u_name" value="" /></li>
						<li><span>身份证号</span><input type="text" placeholder="" name="u_card" id="u_card" value="" /></li>
						<li><span>联系电话</span><input type="text" placeholder="" name="u_phone" id="u_phone" value="" /></li>
						<li><span>店铺地址</span><input type="text" placeholder="" name="u_address" id="u_address" value="" /></li>
						<li><span>店铺名称</span><input type="text" placeholder="" name="u_store" id="u_store" value="" /></li>
					</ul>
					<a id="btn">确定</a>
				</div>
				</div>
			</div>
			<div class="make"></div>
		</div>
		</div>
	</body>
	<script src="/home/js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
	<script src="/home/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="/home/js/iconfont.js" type="text/javascript" charset="utf-8"></script>
	<script src="/home/layer/layer.js"></script>
	<script type="text/javascript">
		$(".input").css("margin-top", "-" + $(".input").height()/2 + "px");
		//		$(".num").css("height",$(".num input").height()+"px")
	</script>
	<script>
		$('#btn').click(function(){
			var u_tel = $('#u_tel').val();
			var recom_id = $('#recom_id').val();
			var u_name = $('#u_name').val();
			var u_card = $('#u_card').val();
			var u_phone = $('#u_phone').val();
			var u_address = $('#u_address').val();
			var u_store = $('#u_store').val();
			var reg = /^1[345678]\d{9}$/;
			var card = /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/i;

			if(recom_id ==""){
				layer.msg('推荐ID不能为空',{icon:5});
				return false;
			}else if(u_name == ""){
				layer.msg('姓名不能为空',{icon:5});
				return false;
			}else if(u_card == ""){
				layer.msg('身份证号不能为空',{icon:5});
				return false;
			}else if(!card.test(u_card)){
				layer.msg('身份证号格式不对',{icon:5});
				return false;
			}else if(u_phone == ""){
				layer.msg('联系电话不能为空',{icon:5});
				return false;
			}else if(!reg.test(u_phone)){
				layer.msg('联系电话格式不对',{icon:5});
				return false;
			}else if(u_address == ""){
				layer.msg('店铺地址不能为空',{icon:5});
				return false;
			}else if(u_store == ""){
				layer.msg('店铺名称不能为空',{icon:5});
				return false;
			}else{
				$.post('/home/login/register',{u_tel:u_tel,recom_id:recom_id,u_name:u_name,u_card:u_card,u_phone:u_phone,u_address:u_address,u_store},function(res){
					if(res.msg=="注册成功"){
						layer.msg(res.msg,{icon:6});
						setTimeout(function(){
                        	window.location.href="/home/index/index";
                    	},1000);
					}
				});
			}
		});
	</script>
</html>